<template>
<div class="student">
    <h3>学生姓名：{{ props.name }}</h3>
    <h3>学生性别：{{ props.sex }}</h3>
    <h3>学生年龄：{{ props.age }}</h3>
    <h3>等级：{{ level }}</h3>
    <h3>教师姓名：{{ tname }}</h3>

</div>

</template>
<script setup>
import { inject, onMounted, ref } from 'vue';

const props=defineProps(['name','age','sex'])

const level=inject('levelKey','本科1')

const tname=ref('')

// console.log(level);
const $bus=inject('$bus')
onMounted(()=>{
    $bus.on('setTname',(val)=>{
        tname.value=val
    })
})

</script>